package com.s69.demo.service;

import com.s69.demo.dao.AppVersionDao;
import com.s69.demo.entity.AppVersion;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class VersionService {
    @Autowired
    AppVersionDao appVersionDao;

    public List<AppVersion> list(Long appid) {
        AppVersion appVersion = new AppVersion();
        appVersion.setAppid(appid);
        List<AppVersion> appVersions = appVersionDao.queryAllBy(appVersion);
        return appVersions;
    }

    public void saveOrUpdate(AppVersion appVersion) {
        if (appVersion.getId() == null) {
            appVersionDao.insert(appVersion);
        } else {
            appVersionDao.update(appVersion);
        }
    }
}
